
package cn.edu.scau.cmi.hombio.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import java.util.Set;

import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import org.codehaus.jackson.annotate.JsonIgnore;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */

@Entity
@NamedQueries({
		@NamedQuery(name = "findAllRoleAuthoritys", query = "select myRoleAuthority from RoleAuthority myRoleAuthority"),
		@NamedQuery(name = "findRoleAuthorityByAdd", query = "select myRoleAuthority from RoleAuthority myRoleAuthority where myRoleAuthority.add = ?1"),
		@NamedQuery(name = "findRoleAuthorityByCheck", query = "select myRoleAuthority from RoleAuthority myRoleAuthority where myRoleAuthority.check = ?1"),
		@NamedQuery(name = "findRoleAuthorityByDelete", query = "select myRoleAuthority from RoleAuthority myRoleAuthority where myRoleAuthority.delete = ?1"),
		@NamedQuery(name = "findRoleAuthorityByEdit", query = "select myRoleAuthority from RoleAuthority myRoleAuthority where myRoleAuthority.edit = ?1"),
		@NamedQuery(name = "findRoleAuthorityById", query = "select myRoleAuthority from RoleAuthority myRoleAuthority where myRoleAuthority.id = ?1"),
		@NamedQuery(name = "findRoleAuthorityByMeno", query = "select myRoleAuthority from RoleAuthority myRoleAuthority where myRoleAuthority.meno = ?1"),
		@NamedQuery(name = "findRoleAuthorityByMenoContaining", query = "select myRoleAuthority from RoleAuthority myRoleAuthority where myRoleAuthority.meno like ?1"),
		@NamedQuery(name = "findRoleAuthorityByPrimaryKey", query = "select myRoleAuthority from RoleAuthority myRoleAuthority where myRoleAuthority.id = ?1") })

@Table(catalog = "pig", name = "role_authority")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "pigRs/cn/edu/scau/cmi/hombio/domain", name = "RoleAuthority")

public class RoleAuthority implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "Id", nullable = false)
	@Basic(fetch = FetchType.EAGER)

	@Id @GeneratedValue
	@XmlElement
	Integer id;
	/**
	* ����Ȩ�ޣ�Ĭ�ϲ���������
	* 
	 */

	@Column(name = "Add", nullable = false)
	@Basic(fetch = FetchType.EAGER)

	@XmlElement
	Boolean add;
	/**
	* ɾ��Ȩ�ޣ�Ĭ�ϲ�����ɾ��
	* 
	 */

	@Column(name = "Delete", nullable = false)
	@Basic(fetch = FetchType.EAGER)

	@XmlElement
	Boolean delete;
	/**
	* �鿴Ȩ�ޣ�Ĭ������鿴
	* 
	 */

	@Column(name = "Check", nullable = false)
	@Basic(fetch = FetchType.EAGER)

	@XmlElement
	Boolean check;
	/**
	* �޸�Ȩ�ޣ�Ĭ�ϲ������޸�
	* 
	 */

	@Column(name = "Edit", nullable = false)
	@Basic(fetch = FetchType.EAGER)

	@XmlElement
	Boolean edit;
	/**
	 */

	@Column(name = "Meno")
	@Basic(fetch = FetchType.EAGER)

	@XmlElement
	String meno;

	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "FunctionId", referencedColumnName = "Id", nullable = false) })
	@XmlTransient
	Function function;
	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "RoleId", referencedColumnName = "Id", nullable = false) })
	@XmlTransient
	Role role;

	/**
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 */
	public Integer getId() {
		return this.id;
	}

	/**
	* ����Ȩ�ޣ�Ĭ�ϲ���������
	* 
	 */
	public void setAdd(Boolean add) {
		this.add = add;
	}

	/**
	* ����Ȩ�ޣ�Ĭ�ϲ���������
	* 
	 */
	public Boolean getAdd() {
		return this.add;
	}

	/**
	* ɾ��Ȩ�ޣ�Ĭ�ϲ�����ɾ��
	* 
	 */
	public void setDelete(Boolean delete) {
		this.delete = delete;
	}

	/**
	* ɾ��Ȩ�ޣ�Ĭ�ϲ�����ɾ��
	* 
	 */
	public Boolean getDelete() {
		return this.delete;
	}

	/**
	* �鿴Ȩ�ޣ�Ĭ������鿴
	* 
	 */
	public void setCheck(Boolean check) {
		this.check = check;
	}

	/**
	* �鿴Ȩ�ޣ�Ĭ������鿴
	* 
	 */
	public Boolean getCheck() {
		return this.check;
	}

	/**
	* �޸�Ȩ�ޣ�Ĭ�ϲ������޸�
	* 
	 */
	public void setEdit(Boolean edit) {
		this.edit = edit;
	}

	/**
	* �޸�Ȩ�ޣ�Ĭ�ϲ������޸�
	* 
	 */
	public Boolean getEdit() {
		return this.edit;
	}

	/**
	 */
	public void setMeno(String meno) {
		this.meno = meno;
	}

	/**
	 */
	public String getMeno() {
		return this.meno;
	}

	/**
	 */
	public void setFunction(Function function) {
		this.function = function;
	}

	/**
	 */
	@JsonIgnore
	public Function getFunction() {
		return function;
	}

	/**
	 */
	public void setRole(Role role) {
		this.role = role;
	}

	/**
	 */
	@JsonIgnore
	public Role getRole() {
		return role;
	}

	/**
	 */
	public RoleAuthority() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(RoleAuthority that) {
		setId(that.getId());
		setAdd(that.getAdd());
		setDelete(that.getDelete());
		setCheck(that.getCheck());
		setEdit(that.getEdit());
		setMeno(that.getMeno());
		setFunction(that.getFunction());
		setRole(that.getRole());
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("id=[").append(id).append("] ");
		buffer.append("add=[").append(add).append("] ");
		buffer.append("delete=[").append(delete).append("] ");
		buffer.append("check=[").append(check).append("] ");
		buffer.append("edit=[").append(edit).append("] ");
		buffer.append("meno=[").append(meno).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((id == null) ? 0 : id.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof RoleAuthority))
			return false;
		RoleAuthority equalCheck = (RoleAuthority) obj;
		if ((id == null && equalCheck.id != null) || (id != null && equalCheck.id == null))
			return false;
		if (id != null && !id.equals(equalCheck.id))
			return false;
		return true;
	}
}
